package Lab3;

import java.util.ArrayList;

public class Shuffle {
    public static void shuffle(ArrayList<Number> list) {
        int index, temp;
        for (int i = list.size() - 1; i >= 0; i--) {
            index = (int) (Math.random() * list.size());
            temp = (int)list.get(i);
            list.set(i, list.get(index));
            list.set(index, temp);
        }
    }

    public static void main(String[] args) {
        ArrayList<Number> list = new ArrayList<>();
        list.add(3);
        list.add(5);
        list.add(6);
        list.add(8);
        list.add(9);
        shuffle(list);

        System.out.println(list);
    }
}
